<?php

/**
 * EmsStatisticsDownloads form base class.
 *
 * @method EmsStatisticsDownloads getObject() Returns the current form's model object
 *
 * @package    ems1
 * @subpackage form
 * @author     Jacobo Martínez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEmsStatisticsDownloadsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'session'            => new sfWidgetFormInputText(),
      'identifier'         => new sfWidgetFormInputText(),
      'download_condition' => new sfWidgetFormInputText(),
      'portal_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Portal'), 'add_empty' => false)),
      'content_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Content'), 'add_empty' => false)),
      'device_brand_name'  => new sfWidgetFormInputText(),
      'device_model_name'  => new sfWidgetFormInputText(),
      'device_user_agent'  => new sfWidgetFormInputText(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'session'            => new sfValidatorString(array('max_length' => 100)),
      'identifier'         => new sfValidatorString(array('max_length' => 100)),
      'download_condition' => new sfValidatorString(array('max_length' => 100)),
      'portal_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Portal'))),
      'content_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Content'))),
      'device_brand_name'  => new sfValidatorString(array('max_length' => 100)),
      'device_model_name'  => new sfValidatorString(array('max_length' => 100)),
      'device_user_agent'  => new sfValidatorString(array('max_length' => 255)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('ems_statistics_downloads[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EmsStatisticsDownloads';
  }

}
